package com.huawei;

import java.util.Scanner;

public class HJ016 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String inputStr = scanner.next();
        String[] splitArr = inputStr.split(";");
        int x=0,y=0;
        for(String str:splitArr){
            if(str.matches("[ASDW]{1}[0-9]{1,2}")){
                String substring = str.substring(1);
                Integer integer = Integer.valueOf(substring);
                if(str.startsWith("A")){
                    x -= integer;
                }else if(str.startsWith("S")){
                    y -= integer;
                }else if(str.startsWith("D")){
                    x += integer;
                }else if(str.startsWith("W")){
                    y += integer;
                }
            }
        }
        System.out.println(x+","+y);
    }
}
